#include <QDateTime>
#include "threadsafedatetimemethods.h"
 QMutex  ThreadSafeDatetimeMethods::mutex;

ThreadSafeDatetimeMethods::ThreadSafeDatetimeMethods(QObject *parent) : QObject(parent)
{

}

QDateTime  ThreadSafeDatetimeMethods:: currentDateTime()
{
    QMutexLocker locker(&mutex);
    return QDateTime::currentDateTime();
}

QDateTime ThreadSafeDatetimeMethods::fromString(const QString &string, Qt::DateFormat format)
{
    QMutexLocker locker(&mutex);
    return QDateTime::fromString(string, format);
}

QDateTime ThreadSafeDatetimeMethods::fromString(const QString &string, const QString &format)
{
    QMutexLocker locker(&mutex);
    return QDateTime::fromString(string, format);
}

QDateTime ThreadSafeDatetimeMethods::fromTime_t(uint seconds)
{
    QMutexLocker locker(&mutex);
    return QDateTime::fromTime_t(seconds);
}
